var express = require('express');
var router = express.Router();



router.post('/api/quickAlloction', function (req, res) {
    // {"income":1,
    // "expenditure":2,
    // "risk":2,
    // "investAsset":50000}

    res.json(
        {
            "body":{
                "sysPlan":{
                    "allcateType":"6",
                    "allocation":[
                        {"assetId":"14","assetName":"类1","color":"64c4b8","percentage":"1.00","rate":"3.00"},
                        {"assetId":"2","assetName":"类2","color":"f5be75","percentage":"31.62","rate":"11.75"},
                        {"assetId":"3","assetName":"类3","color":"64c410","percentage":"27.32","rate":"3.66"},
                        {"assetId":"15","assetName":"类4","color":"67fhkj","percentage":"34.12","rate":"9.00"},
                        {"assetId":"16","assetName":"类5","color":"89uy76","percentage":"5.94","rate":"1.91"}
                    ],
                    "date":"1462955974840",
                    "flux":17,
                    "investAsset":"900000",
                    "label":"舒服撒",
                    "userproperty":"10",
                    "purchas":17,
                    "recommend":"0",
                    "risk":84,
                    "valueAtRisk":"26.25420",
                    "volatility":"15.96",
                    "yield":"8.09"
                },
            },
            "code":"200",
            "message":"operate successfully"
        }
    );
});




router.post('/api/saveAlloction', function(req, res) {
    res.json(
        {"body":true,"code":"200","message":"operate successfully"}
    )
})


// 首页
router.post('/api/showTwoAlloction', function(req, res) {
    res.json(
        {"body":{"sysPlan":{"allcateType":"6","allocation":[{"assetId":"14","assetName":"类1","color":"64c4b8","percentage":"1.00","rate":"3.00"},{"assetId":"2","assetName":"类2","color":"f5be75","percentage":"31.62","rate":"11.75"},{"assetId":"3","assetName":"类3","color":"64c410","percentage":"27.32","rate":"3.66"},{"assetId":"15","assetName":"类4","color":"67fhkj","percentage":"34.12","rate":"9.00"},{"assetId":"16","assetName":"类5","color":"89uy76","percentage":"5.94","rate":"1.91"}],"date":"1462955974840","flux":17,"investAsset":"900000","label":"sfsdf","labeltype":"10","purchas":17,"recommend":"0","risk":84,"valueAtRisk":"26.25420","volatility":"15.96","yield":"8.09"},"userPlan":{"allocation":[{"assetId":"14","assetName":"类6","color":"89jhuy","percentage":"15.00","rate":"3.00"},{"assetId":"3","assetName":"类7","color":"64c410","percentage":"27.14","rate":"3.66"},{"assetId":"15","assetName":"类8","color":"67fhkj","percentage":"23.46","rate":"9.00"},{"assetId":"16","assetName":"其他类","color":"89uy76","percentage":"29.30","rate":"1.91"},{"assetId":"2","assetName":"类9","color":"f5be76","percentage":"5.10","rate":"11.75"}],"date":"1462412767450","flux":84,"investAsset":"900000","label":"sfsadf","labeltype":"5","purchas":51,"recommend":"0","risk":84,"valueAtRisk":"26.25420","volatility":"15.96","yield":"7.23"}},"code":"200","message":"operate successfully"}

    )
})

// 保存
router.post('/api/saveUserDefineAllocation', function(req, res) {
    res.json(
        {
        "body":{},
        "code":"200",
        "message":"operate successfully"
        }

    )
})

module.exports = router;
